<template>
	<view class="">
		<view class="xmain">
			<u-navbar :autoBack="true" bgColor="#ffffff00">
				<template v-slot:left>
					<view class="xflex-x">
						<image class="dwicon" src="/static/image/car/dingwei.png" mode=""></image>
						<view class="dwtext">
							广东·广州
						</view>
					</view>

				</template>

			</u-navbar>

		</view>

		<view class="pr">
			<view class="box pa">
				<view class="bar  xflex-x-between">
					<view class="bar-item xflex-y-center" @click="toPage('/pages/cart/beautiful')">
						<image class="bar-icon" src="/static/image/car/xiu.png" mode=""></image>
						<view class="bar-text">
							骊客秀
						</view>
					</view>

					<view class="bar-item xflex-y-center" @click="nullshow = true">
						<image class="bar-icon" src="/static/image/car/gy.png" mode=""></image>
						<view class="bar-text">
							公益
						</view>
					</view>

					<view class="bar-item xflex-y-center" @click="nullshow = true">
						<image class="bar-icon" src="/static/image/car/menshu.png" mode=""></image>
						<view class="bar-text">
							名宿
						</view>
					</view>

					<view class="bar-item xflex-y-center" @click="nullshow = true">
						<image class="bar-icon" src="/static/image/car/shenghuo.png" mode=""></image>
						<view class="bar-text">
							悦生活
						</view>
					</view>


				</view>


				<view class="lx pr">
					<image class="lx-bg" :src="bbsData.top.bg" mode=""></image>
					<div class="lx-view pa">
						<div class="lx-title">{{bbsData.top.title}}</div>
						<view class="lx-tips">
							{{bbsData.top.intro}}
						</view>
					</div>

					<view class="lx-lj pa xflex-x">
						<view class="">
							了解详情
						</view>
						<image class="lx-icon" @click="toPage(`/pages/index/rich/rich?title=${bbsData.top.title}&name=bbs_content`)"
							src="/static/image/car/gengduo.png" mode=""></image>
					</view>


				</view>

				<view class="yw xp24-32">
					<view class="yw-top xflex-x">
						<view class="yw-title">
							答疑解问
						</view>
						<view class="yw-tips xml20">
							骊客订房全方位与您同行
						</view>
					</view>
					<view class="xmt32 xflex-x-between">
						<template v-for="(item,index) in bbsData.list" :key="index">
							<view class="ts pr" v-if="item.type == '1'">
								<image class="ts-icon" :src="item.bgimage" mode=""></image>
								<view class="ts-box pa">
									<view class="xflex-x">
										<image class="ts-ly" src="/static/image/car/ly.png" mode=""></image>
										<view class="ts-title">
											{{item.title}}
										</view>
									</view>

									<view class="ts-jh xmt20">
										{{item.intro}}
									</view>

									<view class="ts-sy xflex-x xmt20" @click="playAudio(item.file)">
										<view class="ts-bf">
											播放
										</view>
										<image class="ts-bfimg" src="/static/image/car/sw.png" mode=""></image>
									</view>
								</view>
							</view>

							<view class="sh pr" v-if="item.type == '0'">
								<image class="sh-icon" :src="item.bgimage" mode=""></image>
								<view class="sh-box pa">
									<view class="xflex-x">
										<image class="sh-shico" src="/static/image/car/yshi.png" mode=""></image>
										<view class="sh-title">
											{{item.title}}
										</view>
									</view>

									<view class="sh-tips xmt20">
										{{item.intro}}
									</view>
									<view class="sh-next xflex-y-center xmt20"  @click="toPage('/pages/index/rich/rich?type=1&id='+item.id)">
										<image class="sh-img" src="/static/image/car/yshj.png" mode=""></image>
									</view>
								</view>


							</view>

						</template>
					</view>

					<view class="yw-title xmt50">
						骊客订房技巧
					</view>

					<view class="xmt32">
						<u-parse :content="rich"></u-parse>
					</view>
				</view>



			</view>
		</view>
		
		
		<u-popup :show="nullshow" mode="center" :round="18">
			<view class="popup pr xflex-y-center xjc">
			
				<view class="popup-title xmt40">
					提示
				</view>
		
				<view class="popup-content xmt50">
					功能开发中
				</view>
				<view class="popup-btn" @click="nullshow = false">
					我知道了
				</view>
			</view>
		</u-popup>

		<u-tabbar :value="1" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true">
			<template>
				<u-tabbar-item text="订酒店" @click="toReat('/pages/index/index')">
					<image :style="{width: '46rpx',height: '44rpx',}" slot="active-icon"
						src="/static/image/tabbar/home1.png"></image>
					<image :style="{width: '46rpx',height: '44rpx',}" slot="inactive-icon"
						src="/static/image/tabbar/home.png"></image>
				</u-tabbar-item>

				<u-tabbar-item @click="toReat('/pages/cart/cart')">
					<image :style="{width: '80rpx',height: '80rpx',}" slot="active-icon"
						src="/static/image/tabbar/add1.png"></image>
					<image :style="{width: '80rpx',height: '80rpx',}" slot="inactive-icon"
						src="/static/image/tabbar/add.png"></image>
				</u-tabbar-item>

				<u-tabbar-item text="我的" @click="toReat('/pages/mine/mine')">
					<image :style="{width: '46rpx',height: '44rpx',}" slot="active-icon"
						src="/static/image/tabbar/mine1.png"></image>
					<image :style="{width: '46rpx',height: '44rpx',}" slot="inactive-icon"
						src="/static/image/tabbar/mine.png"></image>
				</u-tabbar-item>
			</template>
		</u-tabbar>

	</view>
</template>

<script setup>
	import {
		onReachBottom,
		onShow,
		onLoad
	} from '@dcloudio/uni-app';
	import {
		ref,
		reactive
	} from "vue"
	import {
		indexcontent,
		indexbbs,
		problem
	} from "/network/home.js"
	let test = ref("测试")
	const toReat = (url) => {
		uni.reLaunch({
			url: url
		})
	}
	
	let nullshow = ref(false)

	// const toPage = (url) =>{
	// 	uni.navigateTo({
	// 		url:url
	// 	})
	// }
	let rich = ref('')
	indexcontent({
		name:'order_house_skill'
	}).then(res=>{
		rich.value = res.data
	})

	const playAudio = (url) => {
		var music = null;
		music = uni.createInnerAudioContext();
		music.src = url; // static文件夹下的音频
		music.play(); //执行播放
		music.onEnded(() => {
			//播放结束
			music = null;
		});
	}

	let tab = reactive({
		list: [{
				type: 'solt',
				selected: '/static/image/tabbar/home.png',
				unselected: '/static/image/tabbar/home1.png',
				text: '首页',
				path: '/pages/index/index'
			},
			{
				type: 'solt',
				selected: '/static/image/tabbar/add.png',
				unselected: '/static/image/tabbar/add1.png',
				path: '/pages/cart/cart'
			},
			{
				type: 'solt',
				selected: '/static/image/tabbar/mine.png',
				unselected: '/static/image/tabbar/mine.png',
				text: '我的',
				path: 'pages/mine/mine'
			}
		],
		style: {
			width: '46rpx',
			height: '44rpx',
		},
	})

	const toPage = (url) => {
		uni.navigateTo({
			url: url
		})
	}

	let bbsData = reactive({
		top: {
			bg: '',
			content: '',
			intro: '',
			title: ''
		},
		list: []
	})
	indexbbs().then(res => {
		console.log(res);
		bbsData.top = res.data
	})

	problem().then(res => {

		bbsData.list = res.data
		console.log(bbsData.list);
	})
	// indexcontent({

	// })
</script>

<style lang="scss" scoped>
	.dwicon {
		width: 36rpx;
		height: 36rpx;
	}

	.dwtext {
		font-weight: bold;
		font-size: 32rpx;
		color: #333333;
	}

	.xmain {
		height: 400rpx;
		background: linear-gradient(to bottom, #B3D2FE, #fff);

	}

	.box {
		top: -200rpx;
		width: 100%;
	}

	.bar {
		padding: 60rpx;

		&-icon {
			width: 100rpx;
			height: 100rpx;
		}

		&-text {
			font-weight: 500;
			font-size: 24rpx;
			color: #333333;
		}
	}

	.lx {
		width: 691rpx;
		height: 200rpx;
		margin: auto;

		&-bg {
			width: 100%;
			height: 100%;
		}

		&-view {
			left: 40rpx;
			top: 40rpx;

		}

		&-title {
			font-family: PingFang SC;
			font-weight: 800;
			font-size: 36rpx;
			color: #FFFFFF;
		}

		&-tips {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #FFFFFF;
			margin-top: 16rpx;
		}

		&-lj {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 20rpx;
			color: #FFFFFF;
			right: 20rpx;
			top: 142rpx;
		}

		&-icon {
			width: 24rpx;
			height: 24rpx;
			margin-left: 5rpx;
		}

	}

	.yw {
		&-top {
			align-items: flex-end;
		}

		&-title {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #111111;
		}

		&-tips {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #666666;
		}
	}

	.ts {
		width: 395rpx;
		height: 240rpx;

		&-icon {
			width: 100%;
			height: 100%;
		}

		&-box {
			top: 0;
			width: 395rpx;
			height: 240rpx;
			padding: 28rpx;
			box-sizing: border-box;
		}

		&-ly {
			width: 36rpx;
			height: 36rpx;
		}

		&-title {
			margin-left: 7rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #111111;
		}

		&-jh {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #999999;
		}

		&-sy {
			width: 180rpx;
			height: 50rpx;
			background: linear-gradient(90deg, #0DBFFB, #198EFF);
			border-radius: 16rpx;
			padding: 14rpx 21rpx;
			box-sizing: border-box;
		}

		&-bf {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #FFFFFF;
		}

		&-bfimg {
			width: 40rpx;
			height: 40rpx;
			margin-left: 36rpx;

		}
	}

	.sh {
		width: 275rpx;
		height: 240rpx;

		&-icon {
			width: 100%;
			height: 100%;
		}

		&-box {
			top: 0;
			width: 275rpx;
			height: 240rpx;
			padding: 28rpx;
			box-sizing: border-box;
		}

		&-shico {
			width: 36rpx;
			height: 36rpx;
		}

		&-title {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #111111;
		}

		&-tips {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #999999;
		}

		&-next {
			width: 50rpx;
			height: 50rpx;
			background: rgba(255, 132, 58, 0.1);
			border-radius: 16rpx;
		}

		&-img {
			width: 36rpx;
			height: 36rpx;
		}
	}
	
	
	.popup {
		width: 600rpx;
		height: 370rpx;
		background: #FFFFFF;
		border-radius: 30rpx;
	
		&-gb {
			width: 40rpx;
			height: 40rpx;
			top: 30rpx;
			right: 30rpx;
		}
	
		&-title {
			font-weight: bold;
			font-size: 36rpx;
			color: #111111;
			text-align: center;
		}
	
		&-content {
			padding: 32rpx;
			width: 492rpx;
			height: 149rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #666666;
			line-height: 40rpx;
			text-align: center;
		}
		
		&-btn {
			width: 240rpx;
			height: 80rpx;
			background-color: rgb(211,42,58);
			border-radius: 20rpx;
			line-height: 80rpx;
			text-align: center;
			color: #fff;
		}
	}
</style>